Skip to content

id(currency_poc): break linked chains on Exists legs in InMemoryLedger (#6170) - #6175

Merged
dezren39 merged 1 commit into
mainfrom
queue/9958-6170-linked-exists-parity
Nov 5, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/9958-6170-linked-exists-parity

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes the linked-chain Exists-leg parity gap between InMemoryLedger and TigerBeetle — task 9958 / issue #6170.

Decision (Option A, recorded on #6170): InMemoryLedger matches TigerBeetle. TigerBeetle is the live backend and breaks a linked chain on ANY non-Created status; the reference backend must mirror the live one, not the reverse. The trait surface is the one tb_ledger.rs already presents under its PR #5072 compensation contract.

Change (pkgs/id/src/currency_poc/ledger.rs)

Tests

  • New pinning test linked_chain_with_exists_head_leg_posts_nothing_new in tests.rs: mixed chain result vector, lookup_transfer for the new legs (None), and unchanged balances, plus the whole-chain identical-resubmit control (all-Exists, nothing moves).
  • cargo test -p id currency_poc (laptop): 48 passed, 0 failed (1 ignored live-TB test).
  • cargo test -p id --lib (laptop): 2249 passed, 0 failed, 6 ignored.
  • rustfmt --check clean on both changed files.

Closes #6170


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

#6170)

TigerBeetle breaks a linked chain on ANY non-Created status, so a mixed chain whose head leg is an idempotent Exists resubmission and whose later legs are new posts nothing on the live backend - while InMemoryLedger staged and committed the new legs and moved balances. Scenario tests green against the reference backend therefore certified behavior the live backend rejects.

Option A (recorded on #6170): InMemoryLedger now matches TigerBeetle. A mixed chain posts nothing: the Exists leg reports Exists, every other leg LinkedEventFailed, no balances move. The whole-chain identical resubmission stays per-leg Exists and moves nothing - the surface the tb_ledger binding presents after verifying every stored leg (PR #5072 compensation contract). An earlier Exists leg also wins over a later hard failure, matching chain-order evaluation. The create_transfers trait doc now states the Exists-leg semantics explicitly.

Pinning test linked_chain_with_exists_head_leg_posts_nothing_new covers the mixed chain (result vector, lookup_transfer for the new legs, balances) plus the whole-chain resubmit control; it failed before the change with [Exists, Ok, Ok] and passes after. cargo test -p id currency_poc: 48 passed. Full id lib suite: 2249 passed, 0 failed.
@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 09:06
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c6471519-4394-413b-a9ce-b7588d2528fa
Commits

Reviewing files that changed from the base of the PR and between 1a069c3 and 2a01082.

Files selected for processing: 2

  • pkgs/id/src/currency_poc/ledger.rs
  • pkgs/id/src/currency_poc/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T09:08:30.048295Z 2a01082 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(currency_poc): InMemoryLedger posts new legs behind an Exists head leg in a linked chain — real TigerBeetle breaks the chain and posts nothing

1 participant